00001 /* 00002 * hack4u 00003 * Copyright (C) 2004-2006 emuWorks 00004 * http://games.technoplaza.net/ 00005 * 00006 * This file is part of hack4u. 00007 * 00008 * hack4u is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * hack4u is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with hack4u; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 // $Id: FileIOException.hh,v 1.1 2006/03/14 22:54:22 technoplaza Exp $ 00024 00025 #ifndef _FILEIOEXCEPTION_HH_ 00026 #define _FILEIOEXCEPTION_HH_ 00027 00028 #include <stdexcept> 00029 00030 namespace hack4u { 00031 /// error codes that cause FileIOExceptions to be thrown 00032 enum FileIOError { 00033 FIE_CANNOTOPEN, FIE_IOERROR 00034 }; 00035 00036 class FileIOException : public std::runtime_error { 00037 private: 00038 enum FileIOError error; 00039 00040 public: 00041 /** 00042 * Creates a new FileIOException. 00043 * 00044 * @param error The reason for this FileIOException. 00045 */ 00046 FileIOException(enum FileIOError error); 00047 00048 /** 00049 * Gets the error code of this FileIOException. 00050 */ 00051 enum FileIOError getError() const; 00052 }; 00053 00054 inline FileIOException::FileIOException(enum FileIOError error) : 00055 std::runtime_error("FileIOException"), error(error) {} 00056 00057 inline enum FileIOError FileIOException::getError() const 00058 { return error; } 00059 } 00060 00061 #endif 00062